\section*{Exercise}

Consider the code below that solves the ODE 
\[
\dot{x} = - k x
\]

\lstinputlisting{src/forward_euler_base.cpp}

\begin{enumerate}

\item Refactor the code creating a class 
{\tt forward\_euler} 
that has a constructor to set up method parameters and a method 
{\tt forward\_euler::apply ()} 
to solve the equation.
Let the derivative function be a functor that is passed to the 
{\tt forward\_euler::apply ()}
method.

\item Refactor the code creating a class 
{\tt forward\_euler} 
that has a constructor to set up method parameters and a method 
{\tt forward\_euler::apply ()}  
to solve the equation.
Now define the derivative $\dot x$ as a function taking 3 input arguments 
{\tt real func (real x, real t, real k)} and use {\tt C++11} {\tt lambdas} 
to pass it to {\tt forward\_euler::apply ()}
  
\end{enumerate}

